package view;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/


import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.WindowConstants;

import controler.SistemaIndumentaria;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class BajaConjunto extends javax.swing.JFrame {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private static BajaConjunto instBajaConjunto;
	private JLabel jLabel1;
	private JButton jBAceptar;
	private JLabel jLMensaje;
	private JButton jBCancelar;
	private JTextField jTextCodigo;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		BajaConjunto inst = new BajaConjunto();
		inst.setVisible(true);
	}
	
	private BajaConjunto() {
		super();
		initGUI();
	}
	public static BajaConjunto getInstance(boolean init)
	{
		if (instBajaConjunto==null)
		{
			instBajaConjunto= new BajaConjunto();
			
		}
		if (init)
		{
			instBajaConjunto.inicializarPantalla();
		}
		return instBajaConjunto;
		
	}
	
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			this.setTitle("BAJA DE PRENDA");
			{
				jLabel1 = new JLabel();
				getContentPane().add(jLabel1);
				jLabel1.setText("Codigo");
				jLabel1.setBounds(35, 49, 63, 28);
			}
			{
				jTextCodigo = new JTextField();
				getContentPane().add(jTextCodigo);
				jTextCodigo.setBounds(84, 49, 217, 21);
			}
			{
				jBAceptar = new JButton();
				getContentPane().add(jBAceptar);
				jBAceptar.setText("ACEPTAR");
				jBAceptar.setBounds(28, 133, 112, 28);
				jBAceptar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("jBAceptar.actionPerformed, event="
							+ evt);
						if(SistemaIndumentaria.getInstancia().buscarConjunto(Integer.parseInt(jTextCodigo.getText()))!=null) 
						{
							SistemaIndumentaria.getInstancia().removerConjunto(Integer.parseInt(jTextCodigo.getText()));
							jLMensaje.setForeground(Color.BLUE);
							jLMensaje.setText("EL CONJUNTO FUE ELIMINADA");
						}
						else
						{
							jLMensaje.setForeground(Color.RED);
							jLMensaje.setText("EL CONJUNTO NO EXISTE");
						}
					}
				});
			}
			{
				jBCancelar = new JButton();
				getContentPane().add(jBCancelar);
				jBCancelar.setText("CANCELAR");
				jBCancelar.setBounds(189, 133, 112, 28);
				jBCancelar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("jBCancelar.actionPerformed, event="
							+ evt);
						BajaConjunto.this.setVisible(false);
					}
				});
			}
			{
				jLMensaje = new JLabel();
				getContentPane().add(jLMensaje);
				jLMensaje.setBounds(35, 91, 266, 28);
			}
			pack();
			setSize(400, 300);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private void inicializarPantalla()
	{
	
		//this.txtDni.setText("");
		//this.txtNombre.setText("");
		//this.txtApellido.setText("");
		//this.txtDireccion.setText("");
		//this.txtTelParticular.setText("");
		//this.txtFechaIngreso.setText("");
		//this.txtFechaNacimiento.setText("");
		//this.cargarTabla();
	}
	
}
